package com.qf.pkg.controller;

import com.qf.core.dto.PageDto;
import com.qf.core.vo.PageResult;
import com.qf.core.vo.R;
import com.qf.pkg.entity.PackageTenantPerms;
import com.qf.pkg.service.PackageTenantPermsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhu
 * @since 2023-10-27
 */
@RestController
@RequestMapping("/package-tenant-perms")
@CrossOrigin
public class PackageTenantPermsController {



    @Autowired
    private PackageTenantPermsService packageTenantPermsService;

    @GetMapping("/all")
    public R all(){

        return R.ok(packageTenantPermsService.list());
    }

    @PostMapping("add")
    public R add(@RequestBody PackageTenantPerms packageTenantPerms){

        return packageTenantPermsService.add(packageTenantPerms);
    }

    @PostMapping("update")
    public R update(@RequestBody PackageTenantPerms packageTenantPerms){

        return R.ok(packageTenantPermsService.updateById(packageTenantPerms));
    }

    @PostMapping("delete")
    public R delete(@RequestBody PackageTenantPerms packageTenantPerms){

        return R.ok(packageTenantPermsService.removeById(packageTenantPerms.getId()));
    }

    @PostMapping("page")
    public PageResult<PackageTenantPerms> page(@RequestBody PageDto<PackageTenantPerms> pageDto){

        return packageTenantPermsService.page(pageDto);
    }



}
